<?php


namespace App\Http\Controllers\Platform;


use App\Http\Requests\Platform\AuthGroupRequest;
use App\Services\AuthGroupService;
use App\Utils\ResultUtil;

class AuthGroupController
{
    //权限组分页列表
    public function index(AuthGroupService $authGroupService){
        $page=$authGroupService->page();
        return ResultUtil::data($page);

    }

    //新增权限组
    public function add(AuthGroupRequest $authGroupRequest,AuthGroupService $authGroupService){
        $authGroupRequest->scene('add')->validate();
        $data=$authGroupRequest->validationData();
        $authGroupService->add($data);
        return ResultUtil::success();
    }

    //修改权限组
    public function edit(AuthGroupRequest $authGroupRequest,AuthGroupService $authGroupService){
        $authGroupRequest->scene('edit')->validate();
        $data=$authGroupRequest->validationData();
        $authGroupService->edit($data);
        return ResultUtil::success();
    }

    //删除权限组
    public function del(int $id ,AuthGroupService $authGroupService){
        $authGroupService->del($id);
        return ResultUtil::success();
    }

}
